﻿//*******************************************************************************************************
// InvertBooleanConverter.cs - Inverts Boolean value
//  Copyright © 2008 - TVA, all rights reserved - Gbtc
//
//  Build Environment: C#, Visual Studio 2008
//  Primary Developer: Mehulbhai Thakkar, TVA//      
//       Phone: 423/751-3370
//       Email: mpthakka@tva.gov
//*******************************************************************************************************

using System;
using System.Windows.Data;

namespace PmuRegistry.Silverlight.Converters
{
	public class InvertBooleanConverter : IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (!(value is bool))
				throw new ArgumentException("Value must be a boolean");
			return !((bool)value);
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (!(value is bool))
				throw new ArgumentException("Value must be a boolean");
			return !((bool)value);
		}

		#endregion
	}
}
